//
//  QuestionListTableCell.m
//  DanaKreditLoan
//
//  Created by ZhengChengFeng on 2024/10/19.
//

#import "QuestionListTableCell.h"

@implementation QuestionListTableCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        self.backV = [[UIView alloc] init];
        self.backV.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.backV];
        [self.backV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(15);
            make.right.equalTo(self.contentView.mas_right).offset(-15);
            make.top.equalTo(self.contentView.mas_top);
            make.bottom.equalTo(self.contentView.mas_bottom);
        }];
        
        self.iconV = [[UIImageView alloc] init];
        [self.backV addSubview:self.iconV];
        [self.iconV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.backV.mas_left).offset(15);
            make.width.with.height.equalTo(@15);
            make.top.equalTo(self.backV.mas_top).offset(2.5);
        }];
        
        self.titleLab = [UILabel createLabel:[UIFont fontWithName:kFuturaBT size:13] color:kBlackColor];
        [self.backV addSubview:self.titleLab];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.iconV.mas_right).offset(8);
            make.top.equalTo(self.backV.mas_top);
            make.right.equalTo(self.backV.mas_right).offset(-5);
            make.height.equalTo(@20);
        }];
        
        self.backV.layer.cornerRadius = 15;
        self.backV.layer.masksToBounds = YES;
        
        self.topLeftV = [[UIView alloc] init];
        self.topLeftV.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.topLeftV];
        [self.topLeftV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.backV.mas_left);
            make.width.equalTo(@15);
            make.top.equalTo(self.backV.mas_top);
            make.height.equalTo(@20);
        }];
        
        self.topRightV = [[UIView alloc] init];
        self.topRightV.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.topRightV];
        [self.topRightV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.backV.mas_right);
            make.width.equalTo(@15);
            make.top.equalTo(self.backV.mas_top);
            make.height.equalTo(@20);
        }];
        
        self.bottomV = [[UIView alloc] init];
        self.bottomV.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.bottomV];
        [self.bottomV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.backV.mas_left);
            make.right.equalTo(self.backV.mas_right);
            make.height.equalTo(@15);
            make.bottom.equalTo(self.backV.mas_bottom);
        }];
        
    }
    return self;
}

- (void)setModel:(QuestionListModel *)model{
    _model = model;
    self.titleLab.text = esString(model.hydrogen);
    if (model.isShow) {
        self.iconV.image = [UIImage imageNamed:@"icon_ques4"];
    } else {
        self.iconV.image = [UIImage imageNamed:@"icon_ques3"];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
